







[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
Remove consecutive equal items from a collection, yielding another collection. In each run of consecutive equal items
in the collection, all items after the first item in the run are removed.
Namespace: Wintellect.PowerCollections
Assembly:
PowerCollections (in PowerCollections.dll)
Syntax
| C# |
|---|
public static IEnumerable<T> RemoveDuplicates<T>( IEnumerable<T> collection ) |
| Visual Basic (Declaration) |
|---|
Public Shared Function RemoveDuplicates(Of T) ( _ collection As IEnumerable(Of T) _ ) As IEnumerable(Of T) |
| Visual C++ |
|---|
public: generic<typename T> static IEnumerable<T>^ RemoveDuplicates ( IEnumerable<T>^ collection ) |
Parameters
- collection
- IEnumerable<(Of <T>)>
The collection to process.
Return Value
An new collection with the items from collection, in the same order, with consecutive duplicates removed.
Type Parameters
- T
Remarks
The default sense of equality for T is used, as defined by T's
implementation of IComparable<T>.Equals or object.Equals.
Exceptions
| Exception | Condition |
|---|---|
| System..::ArgumentNullException | collection is null. |
See Also
Algorithms Class
Wintellect.PowerCollections Namespace
